// 变量定义
$primary-color: #1890ff; // 主色调
$success-color: #52c41a; // 成功色
$error-color: #f5222d;   // 错误色
$warning-color: #faad14; // 警告色
$text-color: rgba(0, 0, 0, 0.85); // 主要文字颜色
$text-color-secondary: rgba(0, 0, 0, 0.45); // 次要文字颜色
$border-color: #d9d9d9; // 边框色
$background-color-light: #f5f5f5; // 背景浅色
$background-color-base: #f0f2f5; // 背景基础色
$box-shadow-base: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05); // 基础阴影

// 容器样式
.voiceChatContainer {
  display: flex;
  flex-direction: column;
  width: 320px;
  height: 480px;
  background-color: white;
  border-radius: 8px;
  box-shadow: $box-shadow-base;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

// 头部样式
.voiceChatHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: $primary-color;
  color: white;
  font-size: 16px;
  font-weight: 500;
  
  button {
    color: white;
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    
    &:hover {
      opacity: 0.8;
    }
  }
}

// 消息容器样式
.messagesContainer {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background-color: $background-color-base;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

// 消息通用样式
.message {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  animation: fadeIn 0.3s ease-out;
  
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

// 用户消息样式
.userMessage {
  align-self: flex-end;
  background-color: $primary-color;
  color: white;
  border-top-right-radius: 4px;
}

// AI消息样式
.aiMessage {
  align-self: flex-start;
  background-color: white;
  color: $text-color;
  border: 1px solid $border-color;
  border-top-left-radius: 4px;
}

// 消息内容样式
.messageContent {
  white-space: pre-wrap;
}

// 按钮组样式
.buttonGroup {
  display: flex;
  justify-content: center;
  padding: 16px;
  border-top: 1px solid $border-color;
  background-color: white;
  
  button {
    height: 40px;
    padding: 0 24px;
    font-size: 14px;
    border-radius: 20px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    
    .anticon {
      margin-right: 8px;
      font-size: 16px;
    }
  }
}

// 录音状态样式
.recording {
  position: relative;
  background-color: $error-color !important;
  border-color: $error-color !important;
  
  &::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
  }
  
  @keyframes pulse {
    0% {
      transform: scale(0.8);
      opacity: 0.8;
    }
    70% {
      transform: scale(1.2);
      opacity: 0.2;
    }
    100% {
      transform: scale(0.8);
      opacity: 0.8;
    }
  }
}

// 滚动条样式
.messagesContainer::-webkit-scrollbar {
  width: 6px;
}

.messagesContainer::-webkit-scrollbar-track {
  background: $background-color-light;
  border-radius: 3px;
}

.messagesContainer::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  
  &:hover {
    background-color: rgba(0, 0, 0, 0.3);
  }
}

// 响应式调整
@media (max-width: 480px) {
  .voiceChatContainer {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }
}